package com.liebaut.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class DBInitializer {
    DBSetup dbSetup;

    public static void main(String[] args) throws Exception {
        DBInitializer initializer = new DBInitializer();
        initializer.init();
    }

    public DBInitializer() {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/db-context.xml");
        dbSetup = applicationContext.getBean(DBSetup.class);
    }

    public void init() throws Exception {
        dbSetup.populateData();
    }

}
